home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 June / CHIP 2005-06.iso / program / web / kmsetup.exe / {app} / Motion Scripts / Multi Wipe / effect2.txt
Encoding:
Text File  |  2004-07-28  |  2.1 KB  |  95 lines

  1.  
  2. // main_init function
  3.  
  4. main_init = function(mc){
  5.  
  6.  tmpstr = "0," + ( $vspacing ? $linebreak + "," : "" ) + $sub_cnt;
  7.  line_br = tmpstr.split(",");
  8.  line_cnt = line_br.length-1;
  9.  subs_done = true;
  10.  
  11.  // box function
  12.  
  13.  box = function ( tl_x, tl_y, br_x, br_y ){
  14.   mask.clear();
  15.   mask.lineStyle();
  16.   mask.beginFill(0);
  17.   mask.moveTo (tl_x,tl_y);
  18.   mask.lineTo (br_x,tl_y);
  19.   mask.lineTo (br_x,br_y);
  20.   mask.lineTo (tl_x,br_y);
  21.   mask.endFill();
  22.   wline.clear();
  23.   wline.lineStyle(0,line_color,line_alpha);
  24.   wline.moveTo (tl_x,br_y);
  25.   wline.lineTo (tl_x,tl_y);
  26.   wline.moveTo (br_x,tl_y);
  27.   wline.lineTo (br_x,br_y);
  28.  }
  29.  
  30.  // function to set a line
  31.  
  32.  line_set = function(line){
  33.   line = line % line_cnt;
  34.   line_fc = line_br[line];
  35.   line_lc = line_br[line+1];
  36.   mc = $mmc;
  37.   mc._y = -line * $vspacing;
  38.   b = mc.getBounds(mc);
  39.   xMin = b.xMin;
  40.   xMax = b.xMax;
  41.   yMin = Number.POSITIVE_INFINITY;
  42.   yMax = Number.NEGATIVE_INFINITY;
  43.   for($c=0;$c<$sub_cnt;$c++){
  44.    smc = $smc[$c];
  45.    if ($c >= line_fc && $c < line_lc){
  46.     smc._visible = true;
  47.     b = smc.getBounds(mc);
  48.     yMin = Math.min(yMin,b.yMin + mc._y) ;
  49.     yMax = Math.max(yMax,b.yMax + mc._y);
  50.    } else smc._visible = false;
  51.   }
  52.  }
  53.  
  54.  // effect specific code
  55.  
  56.  createEmptyMovieClip("mask",6);
  57.  createEmptyMovieClip("wline",7);
  58.  mc.setMask(mask);
  59.  lframes = max_wide_frames + 2 * wipe_frames;
  60.  
  61. }
  62.  
  63.  
  64.  
  65. // main_effect function
  66.  
  67. main_effect = function(mc,frame){
  68.  
  69.  sf = frame % lframes;
  70.  if (sf == 0 || frame == 1) line_set(Math.floor(frame/lframes));
  71.  if (sf <= wipe_frames){
  72.   p = sf / wipe_frames;
  73.   if (wipe_in < 1){
  74.    box(xMin,yMin,xMin + (xMax-xMin) * p,yMax);
  75.   } else if (wipe_in > 1){
  76.    box(xMax + (xMin-xMax) * p,yMin,xMax,yMax);
  77.   } else {
  78.    box(xMin * p,yMin,xMax * p,yMax);
  79.   }
  80.  } else if (sf >= lframes - wipe_frames){
  81.   p = (lframes - sf) / wipe_frames;
  82.   if (wipe_out < 1){
  83.    box(xMin,yMin,xMin + (xMax-xMin) * p,yMax);
  84.   } else if (wipe_out > 1){
  85.    box(xMax + (xMin-xMax) * p,yMin,xMax,yMax);
  86.   } else {
  87.    box(xMin * p,yMin,xMax * p,yMax);
  88.   }
  89.  }
  90.  if (frame == line_cnt * lframes){
  91.   wline.clear();
  92.   end_effect = true;
  93.  }
  94. }
  95.